package 洛谷._p2676_bookshelfb;

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static int N = 20010;
    static int[] h = new int[N];
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int b = scanner.nextInt();
        for (int i = 0; i < n; i++) {
            h[i] = scanner.nextInt();
            if(h[i]>=b){
                System.out.println(1);
                return;
            }
        }
        Arrays.sort(h,0,n);
        int sum=0;
        for (int i = 0; i < n; i++) {
            sum += h[n-1-i];
            if(sum >= b){
                System.out.println(i+1);
                break;
            }
        }

        scanner.close();
    }
}
